<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoldChargesTable extends Migration
{
    public function up()
    {
        Schema::create('gold_charges', function (Blueprint $table) {
            $table->id();
	        $table->unsignedBigInteger('user_id')->default(0)->index();
	        $table->string('number', 30)->unique();
	        $table->decimal('total_amount', 10, 2)->default(0);
	        $table->dateTime('paid_at')->nullable()->index();
	        $table->string('paid_method')->nullable()->index();
	        $table->string('paid_number')->nullable()->index();
            $table->timestamps();
	        $table->index(['created_at']);
        });
    }

    public function down()
    {
        Schema::dropIfExists('gold_charges');
    }
}
